cmake_minimum_required(VERSION 3.10)
project(range_examples)

if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
  if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
    add_compile_options(-std=c++20)
  else()
    add_compile_options(-std=c++17 -fconcepts)
  endif()
  find_package(Armadillo)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang AND
    CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
  add_compile_options(-std=c++20)
  find_package(Armadillo)
elseif(MSVC)
  add_compile_options(/std:c++latest /permissive-)
  find_package(Armadillo CONFIG)
else()
  message(FATAL_ERROR "Unrecognized compiler")
endif()

if(Armadillo_FOUND)
  set(HAVE_ARMA 1)
endif()
if(HAVE_ARMA)
  add_compile_options(-DHAVE_ARMA)
endif()

include_directories(../3rd-party/cmcstl2/include)
include_directories(../common)

add_executable(cncpt_test01_integral_concept test01_integral_concept.cpp)
add_executable(cncpt_test02_concepts         test02_concepts.cpp)
add_executable(cncpt_test03_concept_fail     test03_concept_fail.cpp)
add_executable(cncpt_test04_range_concept    test04_range_concept.cpp)

if(HAVE_ARMA)
  target_link_libraries(cncpt_test02_concepts PRIVATE ${ARMADILLO_LIBRARIES})
endif()
